
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="apple-touch-fullscreen" content="yes">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <meta name="applicable-device" content="mobile">
    <meta name="_token" content="AJnWSmvL78sFg77ulDdhsUDGSXLkOC6Tq4gYjBMr"/>
    <title>购物车</title>
    <meta content="义乌购" name="description" />
    <meta content="义乌购" name="keywords" />
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="css/reset.css">
    <link rel="stylesheet" href="css/font-awesome.min.css">
        <link rel="stylesheet" type="text/css" href="css/cart2.css">
    <script type="text/javascript" src="js/jquery.min.js"></script>
</head>
<body>


        <div class="container">
        <div class="topbar">
            <i class="fa fa-angle-left"></i>
            <h1>购物车</h1>
        </div>
        <form action="#">
                                                <div class="cart">
                        <div class="cart-item">
                            <div class="cart-up">
                                <input type="checkbox" class="check">
                                <span>义乌海韵表业有限公司</span>
                                <span class="shopId" style="display:none;">588807</span>

                                                            </div>
                        </div>
                                                    <a href="#" name="926205063"></a>
                            <div class="cart_product" data-type="0" name="926205063">
                        <span class="flag" style="display:none;">
						                                    1
                            					    </span>
                                
                                <div class="buynumber" style="display:none;">
                            <span class="snumb">
                                                                    5
                                                            </span>
                                    <span class="limnub">
                                                                                    455
                                                                            </span>
                                </div>
                                <div class="buy_up">
                                    <div class="proimg" style="background:url('http://img1.yiwugou.com/i004/2015/04/29/60/c73b7f14802f43e6c6a6ec4917aaf031.jpg@300w.jpg') no-repeat;background-size: cover;"></div>
                                    <div class="buymain">
                                        <h1>淘宝热卖 韩版经典小细带女士钻表 </h1>
                                <span class="stock">
                                    供货量:455 &nbsp;起批量:
                                                                            5
                                                                        个
                                </span>

                                    </div>
                                </div>
                                                                    <div class="buy_down" data-key="0">

                                        <div class="down_left">
                                            <input type="checkbox" class="downcheck">
                                        </div>
                                        <div class="down_right">
                                            <span class="up">规格：尺码:深粉 </span>
                                            <div class="totalPrice">￥<strong>200</strong>
                                            </div>
                                            <div class="amount_right">
                                    <span class="down">￥
                                        <strong class="price926205063">
                                                                                            7.00
                                                                                    </strong>
                                    </span>

                                                <div class="unit_amount">
                                                    <a href="javascript:void(0);" class="amount_down fa fa-minus"></a>
                                                    <input type="text" value="5" class="amount_input" data-id="926205063">
                                                    <a href="javascript:void(0);" class="amount_up fa fa-plus"></a>
                                                </div>
                                            </div>
                                            <a href="http://wechat-shop.dev/cart/cartDel/0?shop_id=1" class="fa fa-trash-o fa-amount"></a>
                                        </div>
                                    </div>
                                                                    <div class="buy_down" data-key="4">

                                        <div class="down_left">
                                            <input type="checkbox" class="downcheck">
                                        </div>
                                        <div class="down_right">
                                            <span class="up">规格：尺码:浅绿 </span>
                                            <div class="totalPrice">￥<strong>200</strong>
                                            </div>
                                            <div class="amount_right">
                                    <span class="down">￥
                                        <strong class="price926205063">
                                                                                            7.00
                                                                                    </strong>
                                    </span>

                                                <div class="unit_amount">
                                                    <a href="javascript:void(0);" class="amount_down fa fa-minus"></a>
                                                    <input type="text" value="5" class="amount_input" data-id="926205063">
                                                    <a href="javascript:void(0);" class="amount_up fa fa-plus"></a>
                                                </div>
                                            </div>
                                            <a href="http://wechat-shop.dev/cart/cartDel/4?shop_id=1" class="fa fa-trash-o fa-amount"></a>
                                        </div>
                                    </div>
                                                                    <div class="buy_down" data-key="5">

                                        <div class="down_left">
                                            <input type="checkbox" class="downcheck">
                                        </div>
                                        <div class="down_right">
                                            <span class="up">规格：尺码:浅蓝 </span>
                                            <div class="totalPrice">￥<strong>200</strong>
                                            </div>
                                            <div class="amount_right">
                                    <span class="down">￥
                                        <strong class="price926205063">
                                                                                            7.00
                                                                                    </strong>
                                    </span>

                                                <div class="unit_amount">
                                                    <a href="javascript:void(0);" class="amount_down fa fa-minus"></a>
                                                    <input type="text" value="5  " class="amount_input" data-id="926205063">
                                                    <a href="javascript:void(0);" class="amount_up fa fa-plus"></a>
                                                </div>
                                            </div>
                                            <a href="http://wechat-shop.dev/cart/cartDel/5?shop_id=1" class="fa fa-trash-o fa-amount"></a>
                                        </div>
                                    </div>
                                
                                <div class="pricelist" style="display: none;">
                                                                                                                        <div data-min="5" data-max="99">7.00</div>
                                                                                    <div data-min="100" data-max="9999">6.50</div>
                                                                                    <div data-min="10000" data-max="0">6.30</div>
                                                                                                            </div>
                            </div>
                                                    <a href="#" name="926207581"></a>
                            <div class="cart_product" data-type="2" name="926207581">
                        <span class="flag" style="display:none;">
						                                    1
                            					    </span>
                                
                                <div class="buynumber" style="display:none;">
                            <span class="snumb">
                                                                    10
                                                            </span>
                                    <span class="limnub">
                                                                                    1000
                                                                            </span>
                                </div>
                                <div class="buy_up">
                                    <div class="proimg" style="background:url('http://img1.yiwugou.com/i004/2015/07/07/94/5892df95f63058964300c0dfc22a9b68.jpg@300w.jpg') no-repeat;background-size: cover;"></div>
                                    <div class="buymain">
                                        <h1>韩版时尚新款 椭圆形女士时装表</h1>
                                <span class="stock">
                                    供货量:1000 &nbsp;起批量:
                                                                            10
                                                                        个
                                </span>

                                    </div>
                                </div>
                                                                    <div class="buy_down" data-key="6">

                                        <div class="down_left">
                                            <input type="checkbox" class="downcheck">
                                        </div>
                                        <div class="down_right">
                                            <span class="up">规格：尺码:红 </span>
                                            <div class="totalPrice">￥<strong>200</strong>
                                            </div>
                                            <div class="amount_right">
                                    <span class="down">￥
                                        <strong class="price926207581">
                                                                                            8.00
                                                                                    </strong>
                                    </span>

                                                <div class="unit_amount">
                                                    <a href="javascript:void(0);" class="amount_down fa fa-minus"></a>
                                                    <input type="text" value="10" class="amount_input" data-id="926207581">
                                                    <a href="javascript:void(0);" class="amount_up fa fa-plus"></a>
                                                </div>
                                            </div>
                                            <a href="http://wechat-shop.dev/cart/cartDel/6?shop_id=1" class="fa fa-trash-o fa-amount"></a>
                                        </div>
                                    </div>
                                                                    <div class="buy_down" data-key="7">

                                        <div class="down_left">
                                            <input type="checkbox" class="downcheck">
                                        </div>
                                        <div class="down_right">
                                            <span class="up">规格：尺码:蓝 </span>
                                            <div class="totalPrice">￥<strong>200</strong>
                                            </div>
                                            <div class="amount_right">
                                    <span class="down">￥
                                        <strong class="price926207581">
                                                                                            8.00
                                                                                    </strong>
                                    </span>

                                                <div class="unit_amount">
                                                    <a href="javascript:void(0);" class="amount_down fa fa-minus"></a>
                                                    <input type="text" value="20" class="amount_input" data-id="926207581">
                                                    <a href="javascript:void(0);" class="amount_up fa fa-plus"></a>
                                                </div>
                                            </div>
                                            <a href="http://wechat-shop.dev/cart/cartDel/7?shop_id=1" class="fa fa-trash-o fa-amount"></a>
                                        </div>
                                    </div>
                                
                                <div class="pricelist" style="display: none;">
                                                                                                                        <div data-min="10" data-max="0">7.30</div>
                                                                                                            </div>
                            </div>
                                            </div>
                                    <div class="cart">
                        <div class="cart-item">
                            <div class="cart-up">
                                <input type="checkbox" class="check">
                                <span>龙鲨针织</span>
                                <span class="shopId" style="display:none;">627422</span>

                                                            </div>
                        </div>
                                                    <a href="#" name="927853935"></a>
                            <div class="cart_product" data-type="1" name="927853935">
                        <span class="flag" style="display:none;">
						                                    1
                            					    </span>
                                                                    <div class="cheap" style="display:none;">
                                        <span class="nowtime">1467334031</span>
                                        <span class="starttime">1467208800</span>
                                        <span class="endtime">1468677600</span>
                                        <span class="price">560</span>
                                        <span class="startnum">200</span>
                                        <span class="qlimit">200</span>
                                    </div>
                                
                                <div class="buynumber" style="display:none;">
                            <span class="snumb">
                                                                    200
                                                            </span>
                                    <span class="limnub">
                                                                                    200
                                                                            </span>
                                </div>
                                <div class="buy_up">
                                    <div class="proimg" style="background:url('http://img1.yiwugou.com/i004/2016/06/27/90/2162bb6e4688cb671c6948ceed42c759.jpg@300w.jpg') no-repeat;background-size: cover;"></div>
                                    <div class="buymain">
                                        <h1>拉毛印花打底裤 保暖裤 七分裤 铅笔一体裤</h1>
                                <span class="stock">
                                    供货量:1100 &nbsp;起批量:
                                                                            200
                                        条
                                        限购:200
                                                                                                                条
                                </span>

                                    </div>
                                </div>
                                                                    <div class="buy_down" data-key="1">

                                        <div class="down_left">
                                            <input type="checkbox" class="downcheck">
                                        </div>
                                        <div class="down_right">
                                            <span class="up">规格：尺码:均码 颜色:红色 </span>
                                            <div class="totalPrice">￥<strong>200</strong>
                                            </div>
                                            <div class="amount_right">
                                    <span class="down">￥
                                        <strong class="price927853935">
                                                                                            5.60
                                                                                    </strong>
                                    </span>

                                                <div class="unit_amount">
                                                    <a href="javascript:void(0);" class="amount_down fa fa-minus"></a>
                                                    <input type="text" value="200" class="amount_input" data-id="927853935">
                                                    <a href="javascript:void(0);" class="amount_up fa fa-plus"></a>
                                                </div>
                                            </div>
                                            <a href="http://wechat-shop.dev/cart/cartDel/1?shop_id=1" class="fa fa-trash-o fa-amount"></a>
                                        </div>
                                    </div>
                                                                    <div class="buy_down" data-key="2">

                                        <div class="down_left">
                                            <input type="checkbox" class="downcheck">
                                        </div>
                                        <div class="down_right">
                                            <span class="up">规格：尺码:均码 颜色:绿色 </span>
                                            <div class="totalPrice">￥<strong>200</strong>
                                            </div>
                                            <div class="amount_right">
                                    <span class="down">￥
                                        <strong class="price927853935">
                                                                                            5.60
                                                                                    </strong>
                                    </span>

                                                <div class="unit_amount">
                                                    <a href="javascript:void(0);" class="amount_down fa fa-minus"></a>
                                                    <input type="text" value="200" class="amount_input" data-id="927853935">
                                                    <a href="javascript:void(0);" class="amount_up fa fa-plus"></a>
                                                </div>
                                            </div>
                                            <a href="http://wechat-shop.dev/cart/cartDel/2?shop_id=1" class="fa fa-trash-o fa-amount"></a>
                                        </div>
                                    </div>
                                
                                <div class="pricelist" style="display: none;">
                                                                                                                        <div data-min="50" data-max="199">8.80</div>
                                                                                    <div data-min="200" data-max="999">7.80</div>
                                                                                    <div data-min="1000" data-max="0">5.80</div>
                                                                                                            </div>
                            </div>
                                            </div>
                                    <div class="cart">
                        <div class="cart-item">
                            <div class="cart-up">
                                <input type="checkbox" class="check">
                                <span>新奇特日用品</span>
                                <span class="shopId" style="display:none;">628128</span>

                                                            </div>
                        </div>
                                                    <a href="#" name="927226544"></a>
                            <div class="cart_product" data-type="1" name="927226544">
                        <span class="flag" style="display:none;">
						                                    1
                            					    </span>
                                                                    <div class="cheap" style="display:none;">
                                        <span class="nowtime">1467334031</span>
                                        <span class="starttime">1467194400</span>
                                        <span class="endtime">1468663200</span>
                                        <span class="price">35</span>
                                        <span class="startnum">648</span>
                                        <span class="qlimit"></span>
                                    </div>
                                
                                <div class="buynumber" style="display:none;">
                            <span class="snumb">
                                                                    648
                                                            </span>
                                    <span class="limnub">
                                                                                    879000
                                                                            </span>
                                </div>
                                <div class="buy_up">
                                    <div class="proimg" style="background:url('http://img1.yiwugou.com/i004/2015/10/08/30/bbcf4fdf72b41ee2e874065a86459a56.jpg@300w.jpg') no-repeat;background-size: cover;"></div>
                                    <div class="buymain">
                                        <h1>透明炫彩方口圆底广告杯子一元店漱口杯RS-2814</h1>
                                <span class="stock">
                                    供货量:879000 &nbsp;起批量:
                                                                            648
                                                                                                                个
                                </span>

                                    </div>
                                </div>
                                                                    <div class="buy_down" data-key="3">

                                        <div class="down_left">
                                            <input type="checkbox" class="downcheck">
                                        </div>
                                        <div class="down_right">
                                            <span class="up">规格：</span>
                                            <div class="totalPrice">￥<strong>200</strong>
                                            </div>
                                            <div class="amount_right">
                                    <span class="down">￥
                                        <strong class="price927226544">
                                                                                            0.35
                                                                                    </strong>
                                    </span>

                                                <div class="unit_amount">
                                                    <a href="javascript:void(0);" class="amount_down fa fa-minus"></a>
                                                    <input type="text" value="1296" class="amount_input" data-id="927226544">
                                                    <a href="javascript:void(0);" class="amount_up fa fa-plus"></a>
                                                </div>
                                            </div>
                                            <a href="http://wechat-shop.dev/cart/cartDel/3?shop_id=1" class="fa fa-trash-o fa-amount"></a>
                                        </div>
                                    </div>
                                
                                <div class="pricelist" style="display: none;">
                                                                                                                        <div data-min="648" data-max="0">0.35</div>
                                                                                                            </div>
                            </div>
                                            </div>
                                    <div class="cart">
                        <div class="cart-item">
                            <div class="cart-up">
                                <input type="checkbox" class="check">
                                <span>绿舒坦人造草坪</span>
                                <span class="shopId" style="display:none;">556730</span>

                                                            </div>
                        </div>
                                                    <a href="#" name="925362862"></a>
                            <div class="cart_product" data-type="0" name="925362862">
                        <span class="flag" style="display:none;">
						                                    1
                            					    </span>
                                
                                <div class="buynumber" style="display:none;">
                            <span class="snumb">
                                                                    50
                                                            </span>
                                    <span class="limnub">
                                                                                    9947
                                                                            </span>
                                </div>
                                <div class="buy_up">
                                    <div class="proimg" style="background:url('http://img1.yiwugou.com/i004/2015/07/07/95/e70243a080734f2bb2c33e8c5796014f.jpg@300w.jpg') no-repeat;background-size: cover;"></div>
                                    <div class="buymain">
                                        <h1>仿真草坪人造草坪人工草皮塑料假草坪幼儿园学校楼顶阳台绿色地毯</h1>
                                <span class="stock">
                                    供货量:9947 &nbsp;起批量:
                                                                            50
                                                                        平方
                                </span>

                                    </div>
                                </div>
                                                                    <div class="buy_down" data-key="8">

                                        <div class="down_left">
                                            <input type="checkbox" class="downcheck">
                                        </div>
                                        <div class="down_right">
                                            <span class="up">规格：果绿:2*25 果绿色20mm:1*25 </span>
                                            <div class="totalPrice">￥<strong>200</strong>
                                            </div>
                                            <div class="amount_right">
                                    <span class="down">￥
                                        <strong class="price925362862">
                                                                                            28.00
                                                                                    </strong>
                                    </span>

                                                <div class="unit_amount">
                                                    <a href="javascript:void(0);" class="amount_down fa fa-minus"></a>
                                                    <input type="text" value="50  " class="amount_input" data-id="925362862">
                                                    <a href="javascript:void(0);" class="amount_up fa fa-plus"></a>
                                                </div>
                                            </div>
                                            <a href="http://wechat-shop.dev/cart/cartDel/8?shop_id=1" class="fa fa-trash-o fa-amount"></a>
                                        </div>
                                    </div>
                                                                    <div class="buy_down" data-key="10">

                                        <div class="down_left">
                                            <input type="checkbox" class="downcheck">
                                        </div>
                                        <div class="down_right">
                                            <span class="up">规格：果绿:1*25 果绿色20mm:1*25 </span>
                                            <div class="totalPrice">￥<strong>200</strong>
                                            </div>
                                            <div class="amount_right">
                                    <span class="down">￥
                                        <strong class="price925362862">
                                                                                            28.00
                                                                                    </strong>
                                    </span>

                                                <div class="unit_amount">
                                                    <a href="javascript:void(0);" class="amount_down fa fa-minus"></a>
                                                    <input type="text" value="50  " class="amount_input" data-id="925362862">
                                                    <a href="javascript:void(0);" class="amount_up fa fa-plus"></a>
                                                </div>
                                            </div>
                                            <a href="http://wechat-shop.dev/cart/cartDel/10?shop_id=1" class="fa fa-trash-o fa-amount"></a>
                                        </div>
                                    </div>
                                
                                <div class="pricelist" style="display: none;">
                                                                                                                        <div data-min="50" data-max="299">28.00</div>
                                                                                    <div data-min="300" data-max="499">27.80</div>
                                                                                    <div data-min="500" data-max="0">27.50</div>
                                                                                                            </div>
                            </div>
                                            </div>
                                    <div class="cart">
                        <div class="cart-item">
                            <div class="cart-up">
                                <input type="checkbox" class="check">
                                <span>和胜玩具</span>
                                <span class="shopId" style="display:none;">528361</span>

                                                            </div>
                        </div>
                                                    <a href="#" name="926913359"></a>
                            <div class="cart_product" data-type="0" name="926913359">
                        <span class="flag" style="display:none;">
						                                    1
                            					    </span>
                                
                                <div class="buynumber" style="display:none;">
                            <span class="snumb">
                                                                    20
                                                            </span>
                                    <span class="limnub">
                                                                                    888482
                                                                            </span>
                                </div>
                                <div class="buy_up">
                                    <div class="proimg" style="background:url('http://img1.yiwugou.com/i004/2015/07/12/57/800fbe8dc221dda959574fa7b49a4556.jpg@300w.jpg') no-repeat;background-size: cover;"></div>
                                    <div class="buymain">
                                        <h1>正版 有版权证  厂家直销  树墩树桩仿真水果坐垫 创意百货 </h1>
                                <span class="stock">
                                    供货量:888482 &nbsp;起批量:
                                                                            20
                                                                        个
                                </span>

                                    </div>
                                </div>
                                                                    <div class="buy_down" data-key="9">

                                        <div class="down_left">
                                            <input type="checkbox" class="downcheck">
                                        </div>
                                        <div class="down_right">
                                            <span class="up">规格：尺码:39乘7CM海绵 颜色:正版4西瓜号 </span>
                                            <div class="totalPrice">￥<strong>200</strong>
                                            </div>
                                            <div class="amount_right">
                                    <span class="down">￥
                                        <strong class="price926913359">
                                                                                            15.00
                                                                                    </strong>
                                    </span>

                                                <div class="unit_amount">
                                                    <a href="javascript:void(0);" class="amount_down fa fa-minus"></a>
                                                    <input type="text" value="20  " class="amount_input" data-id="926913359">
                                                    <a href="javascript:void(0);" class="amount_up fa fa-plus"></a>
                                                </div>
                                            </div>
                                            <a href="http://wechat-shop.dev/cart/cartDel/9?shop_id=1" class="fa fa-trash-o fa-amount"></a>
                                        </div>
                                    </div>
                                
                                <div class="pricelist" style="display: none;">
                                                                                                                        <div data-min="20" data-max="119">15.00</div>
                                                                                    <div data-min="120" data-max="199">13.50</div>
                                                                                    <div data-min="200" data-max="0">13.00</div>
                                                                                                            </div>
                            </div>
                                            </div>
                                    <div class="cart">
                        <div class="cart-item">
                            <div class="cart-up">
                                <input type="checkbox" class="check">
                                <span>亿博人造花</span>
                                <span class="shopId" style="display:none;">522064</span>

                                                            </div>
                        </div>
                                                    <a href="#" name="927698547"></a>
                            <div class="cart_product" data-type="0" name="927698547">
                        <span class="flag" style="display:none;">
						                                    1
                            					    </span>
                                
                                <div class="buynumber" style="display:none;">
                            <span class="snumb">
                                                                    10
                                                            </span>
                                    <span class="limnub">
                                                                                    999999
                                                                            </span>
                                </div>
                                <div class="buy_up">
                                    <div class="proimg" style="background:url('http://img1.yiwugou.com/i004/2016/04/13/94/b070df143098896700339f68a83738d2.png@300w.jpg') no-repeat;background-size: cover;"></div>
                                    <div class="buymain">
                                        <h1>高档保湿玫瑰仿真花单枝手感玫瑰花家居装饰 淘宝爆款</h1>
                                <span class="stock">
                                    供货量:999999 &nbsp;起批量:
                                                                            10
                                                                        个
                                </span>

                                    </div>
                                </div>
                                                                    <div class="buy_down" data-key="11">

                                        <div class="down_left">
                                            <input type="checkbox" class="downcheck">
                                        </div>
                                        <div class="down_right">
                                            <span class="up">规格：</span>
                                            <div class="totalPrice">￥<strong>200</strong>
                                            </div>
                                            <div class="amount_right">
                                    <span class="down">￥
                                        <strong class="price927698547">
                                                                                            3.00
                                                                                    </strong>
                                    </span>

                                                <div class="unit_amount">
                                                    <a href="javascript:void(0);" class="amount_down fa fa-minus"></a>
                                                    <input type="text" value="10  " class="amount_input" data-id="927698547">
                                                    <a href="javascript:void(0);" class="amount_up fa fa-plus"></a>
                                                </div>
                                            </div>
                                            <a href="http://wechat-shop.dev/cart/cartDel/11?shop_id=1" class="fa fa-trash-o fa-amount"></a>
                                        </div>
                                    </div>
                                
                                <div class="pricelist" style="display: none;">
                                                                                                                        <div data-min="10" data-max="575">3.00</div>
                                                                                    <div data-min="576" data-max="0">2.80</div>
                                                                                                            </div>
                            </div>
                                            </div>
                
            
        </form>
        <div class="notifications"></div>

        <form action="">

            <div class="cartbar">
                <div class="cartbar_btn">
                    <input type="checkbox" class="allcheck" id="allcheck">
                    <label for="allcheck">全选</label>
                </div>
                <div class="cartbar_btn">
                    <span>货款合计<i>￥</i><strong>0.00</strong></span>
                    <span>(不含运费)</span>
                </div>
                <div class="cartbar_btn">
                    结算
                </div>
            </div>
        </form>

    </div>

    <script type="text/javascript">
        $(function () {

            makeUnitPrice();

            if (parseInt($(".cartbar_btn:nth-child(2) strong").text()) == 0) {
                $(".cartbar_btn:nth-child(3)").addClass("noselected");
            }

            $(".cartbar_btn:nth-child(3)").click(function () {
                if ($(this).hasClass("noselected")) {
                    return false;
                }

                var submit = true;

                $(".cart_product").each(function () {
                    var total = 0;
                    $(this).find('.buy_down input[checked=checked]').each(function () {
                        total += parseInt($(this).parents('.buy_down').find('.amount_input').val());
                    });
                    var max = parseInt($(this).find('.limnub').text()), min = parseInt($(this).find('.snumb').text());
                    if (total != 0 && total < min) {
                        $(".notifications").text("采购量不能小于起批量").show();
                        setTimeout(function () {
                            $(".notifications").text("").hide();
                        }, 1500);

                        submit = false;
                        location.hash = "#" + $(this).attr("name");
                    }
                    if (total > max) {
                        if ($(this).attr('data-type') == 1) {
                            $(".notifications").text("采购量不能大于限购数量").show();
                        } else {
                            $(".notifications").text("采购量不能大于库存").show();
                        }

                        setTimeout(function () {
                            $(".notifications").text("").hide();
                        }, 1500);

                        submit = false;
                        location.hash = "#" + $(this).attr("name");
                    }
                });
                if (submit) {
                    var $dataString = "[";
                    var length = $('.buy_down input[checked=checked]').length;
                    var key = "";

                    $('.buy_down input[checked=checked]').each(function ($key) {
                        var $cart = $(this).parents('.cart'),
                                $cartProduct = $(this).parents('.cart_product'),
                                $buyDown = $(this).parents('.buy_down');

                        var id = $cartProduct.find(".amount_input").attr("data-id"),
                                property = $buyDown.find(".up").text().substring(3),
                                property = property.substring(0, property.length - 2),
                                amount = $buyDown.find(".amount_input").val(),
                                type = $cartProduct.attr('data-type'),
                                kdata = $buyDown.attr('data-key'),
                                shopId = $cart.find('.shopId').text(),
                                flag = $cartProduct.find('.flag').text();
                        if ($key == length - 1) {
                            key += kdata;
                            $dataString += '{"id":' + id + ',"amount":' + amount + ',"property":"' + property + '","type":' + type + ',"marketShopId":' + shopId + ',"freightFlag":' + flag + '}';
                        } else {
                            key += kdata + ',';
                            $dataString += '{"id":' + id + ',"amount":' + amount + ',"property":"' + property + '","type":' + type + ',"marketShopId":' + shopId + ',"freightFlag":' + flag + '},';
                        }

                    });
                    $dataString += "]";
                    var $data = JSON.parse($dataString);

                    $.ajax({
                        type: "post",
                        url: "http://wechat-shop.dev/cart/cartOrder?shop_id=1",
                        data: {"data": $data, "kdata": key},
                        dataType: "json",
                        headers: {
                            'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
                        },
                        success: function (data) {
                            //window.location.href = "http://wechat-shop.dev/order/create?shop_id=1";
                        },
                        error: function () {

                        }
                    });
                }
            });

            $(".fa-angle-left").click(function () {
                window.history.back(-1);
            });

            $(".amount_down").click(function () {
                var $this = $(this).parents('.cart_product');
                var $input = $(this).parent().find("input");
                if ($input.val() > 0 && $input.val() > parseInt($this.find('.snumb').text())) {
                    $input.val(parseInt($input.val()) - 1);
                }
                var $id = $input.attr("data-id");
                makePrice($id, $this);
                makeUnitPrice();
                totalmoney();
            });

            $(".amount_up").click(function () {
                var $this = $(this).parents('.cart_product');
                var $input = $(this).parent().find("input");
                if ($input.val() < parseInt($this.find('.limnub').text())) {
                    $input.val(parseInt($input.val()) + 1);
                }
                var $id = $input.attr("data-id");
                makePrice($id, $this);
                makeUnitPrice();
                totalmoney();
            });

            $(".check").click(function () {
                var $downCheck = $(this).parents('.cart').find('.downcheck');
                if ($(this).is(':checked')) {
                    $(this).attr('checked', 'checked');
                    $downCheck.each(function () {
                        $(this).attr('checked', 'checked');
                        var $this = $(this).parents('.cart_product');
                        var $id = $(this).parents('.buy_down').find(".amount_input").attr("data-id");
                        makePrice($id, $this);
                    });
                    totalmoney();

                } else {
                    $(this).attr("checked", false);
                    $downCheck.each(function () {
                        $(this).attr("checked", false);
                        var $this = $(this).parents('.cart_product');
                        var $id = $(this).parents('.buy_down').find(".amount_input").attr("data-id");
                        makePrice($id, $this);
                    });
                    totalmoney();
                }
            });

            $(".downcheck").click(function () {
                $this = $(this).parents('.cart_product');
                $id = $(this).parents('.buy_down').find(".amount_input").attr("data-id");
                if ($(this).is(':checked')) {
                    $(this).attr('checked', 'checked');
                    makePrice($id, $this);
                    makeUnitPrice();
                    totalmoney();
                } else {
                    $(this).attr("checked", false);
                    $(this).parents('.cart').find('.check').attr("checked", false);
                    makePrice($id, $this);
                    makeUnitPrice();
                    totalmoney();
                }
            });

            $(".allcheck").click(function () {

                if ($(this).is(':checked')) {
                    $(".check").each(function () {
                        $(this).attr("checked", "checked");
                    });
                    $(".downcheck").each(function () {
                        $(this).attr("checked", "checked");
                    });

                    totalmoney();
                } else {
                    $(".check").each(function () {
                        $(this).attr("checked", false);
                    });
                    $(".downcheck").each(function () {
                        $(this).attr("checked", false);
                    });

                    totalmoney();
                }

            });

            $(".amount_input").change(function () {
                var $this = $(this).parents('.cart_product');
                /* if ($(this).val() < parseInt($this.find('.snumb').text())) {
                 $(".notifications").text("采购量不能小于起批量").show();
                 setTimeout(function () {
                 $(".notifications").text("").hide();
                 }, 1500);
                 $(this).val(parseInt($this.find('.snumb').text()));
                 }

                 if ($(this).val() > parseInt($this.find('.limnub').text())) {
                 if ($this.attr('data-type') == 1) {
                 $(".notifications").text("采购量不能大于限购数量或是供货量").show();
                 } else {
                 $(".notifications").text("采购量不能大于供货量").show();
                 }

                 setTimeout(function () {
                 $(".notifications").text("").hide();
                 }, 1500);
                 $(this).val(parseInt($this.find('.limnub').text()));
                 }*/
                var $id = $(this).attr("data-id");
                makePrice($id, $this);
                makeUnitPrice();
                totalmoney();
            });

        });

        function makeUnitPrice() {
            $(".totalPrice strong").each(function (key) {
                var $this = $(this).parents('.down_right');
                var UnitPrice = parseFloat($this.find(".down strong").text()) * 100;
                var amount = parseInt($this.find(".amount_input").val())
                $(this).text(parseFloat((UnitPrice * amount) / 100).toFixed(2));
            });
        }

        function makePrice($id, $this) {
            var type = $this.attr('data-type');
            var amount = 0, amountChecked = 0, amountUnChecked = 0;
            $(".amount_input[data-id=" + $id + "]").each(function () {
                amount += parseInt($(this).val());
                if ($(this).parents('.buy_down').find('.downcheck').is(':checked')) {
                    amountChecked += parseInt($(this).val());
                } else {
                    amountUnChecked += parseInt($(this).val());
                }
            });

            /*alert("amountChecked:" + amountChecked);
             alert("amountUnChecked:" + amountUnChecked);
             alert("amount:" + amount);*/

            if (type == 2) {
                return false;
            } else if (type == 1 /*&& parseInt($('.nowtime').text()) > parseInt($('.starttime').text())*/
                    && parseInt($('.nowtime').text()) < parseInt($('.endtime').text())) {
                if (amountChecked > parseInt($this.find('.limnub').text())) {
                    $(".notifications").text("采购量不能大于限购数量或是供货量").show();
                    setTimeout(function () {
                        $(".notifications").text("").hide();
                    }, 1500);
                }
                $(".price" + $id).each(function () {
                    $(this).text(($this.find('.price').text() / 100).toFixed(2));
                });
            } else {
                ladderPrice($this, $id, amountChecked, amountUnChecked);
            }
        }

        function ladderPrice($this, $id, amountChecked, amountUnChecked) {
            $this.find(".pricelist div").each(function (key) {
                var max = $(this).attr("data-max"),
                        min = $(this).attr("data-min"),
                        $this = $(this).text(),
                        $check = $(this).parents('.cart_product').find('.downcheck');

                if (key == 0) {
                    $check.each(function () {
                        if ($(this).is(':checked')) {
                            if (min >= amountChecked) {
                                $(this).parents('.buy_down').find(".price" + $id).text($this);
                            }
                        } else {
                            if (min >= amountUnChecked) {
                                $(this).parents('.buy_down').find(".price" + $id).text($this);
                            }
                        }
                    });

                }

                $check.each(function () {
                    if ($(this).is(':checked')) {
                        if ((max == 0 || max == '') && min <= amountChecked) {
                            $(this).parents('.buy_down').find(".price" + $id).text($this);

                        } else if (max >= amountChecked && min <= amountChecked) {
                            $(this).parents('.buy_down').find(".price" + $id).text($this);
                        }
                    } else {
                        if ((max == 0 || max == '') && min <= amountUnChecked) {
                            $(this).parents('.buy_down').find(".price" + $id).text($this);

                        } else if (max >= amountUnChecked && min <= amountUnChecked) {
                            $(this).parents('.buy_down').find(".price" + $id).text($this);
                        }
                    }
                });

            });
        }

        function totalmoney() {

            var $money = 0;
            $(".downcheck[checked=checked]").each(function () {
                var $this = $(this).parents('.buy_down');
                var price = parseFloat($this.find(".down strong").text()) * 100;
                var num = parseInt($this.find(".amount_input").val());
                $money += price * num;
                $(".cartbar_btn strong").text(parseFloat($money / 100).toFixed(2));
            });
            $(".cartbar_btn strong").text(parseFloat($money / 100).toFixed(2));
            if (parseInt($(".cartbar_btn:nth-child(2) strong").text()) == 0) {
                $(".cartbar_btn:nth-child(3)").addClass("noselected");
            }

            if (parseInt($(".cartbar_btn:nth-child(2) strong").text()) > 0) {
                $(".cartbar_btn:nth-child(3)").removeClass("noselected");
            }

        }
    </script>
</body>
</html>